import requests

class RunMain():
    def runmain(self,method,url,headers,data,param):
        try:
            if method == 'post':
                r = requests.post(url=url, headers=headers, json=data)
                resp = r.json()
                # print("执行结果：",resp)

            else:
                r = requests.get(url = url ,headers = headers,params=param)
                resp = r.json()
                # print("执行结果：",resp)

        except Exception as e:
            resp = e
            print("接口请求出错：",resp)

        return resp